<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>

<s:layout-render name="/layout_admin.jsp">
    <s:layout-component name="content">
        <c:if test="${not empty actionBean.order.orderedPackageTour.availableTours}">
            <f:message key="order.tours" /><c:out value="${actionBean.order.orderedPackageTour.name}" />
            <table>
                <tr>
                    <th><f:message key="tour.name"/></th>
                    <th><f:message key="tour.pricePerPerson"/></th>
                    <th><f:message key="tour.date"/></th>
                    <th><f:message key="tour.capacity"/></th>
                    <th><f:message key="tour.description"/></th>
                </tr>
                <c:forEach items="${actionBean.order.orderedPackageTour.availableTours}" var="tour">
                    <tr>
                        <td><c:out value="${tour.name}"/></td>
                        <td><c:out value="${tour.pricePerPerson}"/></td>
                        <f:formatDate value="${tour.date}" pattern="dd-MM-yyyy" var="stDate"/>
                        <td><c:out value="${stDate}"/></td>
                        <td><c:out value="${tour.capacity}"/></td>
                        <td><c:out value="${tour.description}"/></td>
                    </tr>
                </c:forEach>
            </table>
            <br>
        </c:if>
        <s:form beanclass="cz.muni.fi.pa165.travelagency.web.OrderActionBean">
            <fieldset><legend><f:message key="order.action.add" /></legend>
                <table>
                    <tr>
                        <td>
                            <s:label for="o1" name="tour.tours"/>
                        </td>
                        <td>
                            <s:select name="tour.ids" multiple="true">  
                                <s:options-collection collection="${actionBean.order.orderedPackageTour.availableTours}" value="id" label="name" />  
                            </s:select>                            
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <s:param name="order.id" value="${actionBean.order.id}"/>

                            <s:submit name="add-tours"><f:message key="order.action.add" /></s:submit>
                        </td>
                    </tr>
                </table>
                </fieldset>
        </s:form>
    </s:layout-component>
</s:layout-render>